import { defHttp } from '/@/utils/http/axios';
import { ContentTypeEnum } from '@/enums/httpEnum';
import { QueryProductAssistanceVo } from '@/api/base-data/product/assistance/model/queryProductAssistanceVo';
import { QueryProductAssistanceBo } from '@/api/base-data/product/assistance/model/queryProductAssistanceBo';
import { CreateProductAssistanceVo } from '@/api/base-data/product/assistance/model/createProductAssistanceVo';

const baseUrl = '/basedata/product/assistance';
const region = 'cloud-api';

/**
 * 查询列表
 * @param params
 * @returns {Promise}
 */
export function query(params: QueryProductAssistanceVo): Promise<QueryProductAssistanceBo[]> {
  return defHttp.get<QueryProductAssistanceBo[]>(
    {
      url: baseUrl + '/query',
      params: params,
    },
    {
      region,
    },
  );
}

/**
 * 新增
 * @param params
 * @returns {Promise}
 */
export function create(params: CreateProductAssistanceVo): Promise<void> {
  return defHttp.post<void>(
    {
      url: baseUrl,
      data: params,
    },
    {
      contentType: ContentTypeEnum.JSON,
      region,
    },
  );
}
